package dbUtil;

import java.sql.Connection;
import java.sql.DriverManager;
//根据题意，修改文件为DBUtil.java
public class DBUtil {
	//数据库5大参数
	private static final String IP = "127.0.0.1";
	private static final String PORT = "3306";
	private static final String DATABASE_NAME = "pww";
	private static final String USER_NAME = "root";
	private static final String PASSWORD = "123";
	private static final String DRIVER = "com.mysql.jdbc.Driver";
	
	public static Connection getConnection() throws Exception {
		String url = "jdbc:mysql://"+IP+":"+PORT+"/"+DATABASE_NAME+"?user="+USER_NAME+"&password="+PASSWORD+"";
		Class.forName(DRIVER);
		Connection conn = DriverManager.getConnection(url);
		//System.out.println("ConnManager已经创建了连接："+conn);
		return conn;
	}
}
